﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

namespace Grundy.Message
{
    
    [CollectionDataContract]
    public class LicenseCollection : ICollection<License>
    {
        private List<License> _licenses;

        public LicenseCollection()
        {
            _licenses = new List<License>();
        }

        public LicenseCollection(IEnumerable<License> licenses)
        {
            _licenses = licenses.ToList();
        }

        public IEnumerator<License> GetEnumerator()
        {
            return _licenses.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        public void Add(License item)
        {
            _licenses.Add(item);
        }

        public void Clear()
        {
            _licenses.Clear();
        }

        public bool Contains(License item)
        {
            return _licenses.Contains(item);
        }

        public void CopyTo(License[] array, int arrayIndex)
        {
            _licenses.CopyTo(array, arrayIndex);
        }

        public bool Remove(License item)
        {
            return _licenses.Remove(item);
        }

        public int Count
        {
            get { return _licenses.Count; }
        }

        public bool IsReadOnly
        {
            get { return false; }
        }
    }
}